<style type="text/css">
    .dropdown-menu {
        max-height: 303px;
    }

    .merged_color {
        color: red;
        background-color: #dedede;
    }

    .switch {
        width: 28px;
        height: 14px;
    }

    .switch small {
        width: 14px;
        height: 14px;
    }

    .switch.checked small {
        left: 13px;
    }

    .dropdown-menu {
        max-height: 303px;
    }
</style>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <span>项目: <span style="color: #1da7ee">{{info.project.plan_name}}</span></span>
                    <span style="margin-left: 2%;" ng-if="info.integrationInfo != null">集成计划:
                        <a href="javascript:void(0);" class="btn-link" type="button"
                           ng-click="toIntegrationSet(info.integrationInfo.integration_name);">{{info.integrationInfo.integration_name}}</a>
                    </span>
                    <br>
                    <br>
                    <div ng-if="info.project.plan_status == 'PLAN_NEW'">
                        <p>
                            <input ng-model="info.checked" ng-true-value="true"
                                   ng-if="info.modifiAble"
                                   ng-false-value="false" type="checkbox">
                            <span ng-if="info.modifiAble">作为项目负责人，已经检查过基本功能，同意将项目提交给集成测试环境</span>
                        </p>
                        <button class="btn btn-default pull-left" ng-if="info.modifiAble"
                                ng-disabled="!info.checked"
                                data-ng-click="doIntegration();">转测集成
                        </button>
                        <span ng-show="info.modifiAble && !info.checked"
                              style="line-height: 30px;margin-left: 50px;color: red;">请确认项目无误后，再转测集成</span>
                        <!--<span ng-show="info.modifiAble && !info.can_Integration"-->
                        <!--style="line-height: 30px;margin-left: 50px;color: red;">当前项目内存在没有转测的工程，不能集成</span>-->
                    </div>
                    <span ng-if="info.project.plan_status != 'PLAN_NEW'">项目已经转测集成</span>
                </div>
                <div class="box-body">
                    <div class="container-fluid">
                        <div class="row-fluid">

                            <div class="span12">
                                <ul class="nav nav-tabs">
                                    <li class="" ng-class="{true:'active',false:''}[info.index==0]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(0)"
                                        >
                                            工程列表
                                        </a>
                                    </li>
                                    <li class="" ng-class="{true:'active',false:''}[info.index==1]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(1)"
                                        >
                                            基本信息
                                        </a>
                                    </li>
                                    <li class="" ng-class="{true:'active',false:''}[info.index==2]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(2)"
                                        >
                                            人员列表
                                        </a>
                                    </li>
                                    <li class="" ng-class="{true:'active',false:''}[info.index==3]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(3)"
                                        >
                                            虚拟机申请
                                        </a>
                                    </li>
                                    <li class="" ng-class="{true:'active',false:''}[info.index==4]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(4)"
                                        >
                                            测试记录
                                        </a>
                                    </li>
                                </ul>

                                <div class="row">
                                    <div class="col-xs-12">
                                        <div ng-if="info.index == '0'">
                                            <div class="box-header">
                                                <img src="/beetle/image/icon_plus-box.png" ng-if="info.modifiAble"
                                                     ng-click="add();"
                                                     style="cursor: pointer;"
                                                     data-toggle="popover" data-placement="auto top"
                                                     data-content="为项目添加工程"
                                                     data-trigger="hover">
                                                <span style="margin-left: 4%;">分支代号: {{info.project.plan_code}}</span>
                                                <br>
                                                <br>
                                                <span ng-if="info.project.error_desc != null" style="color: red;">工程创建失败：{{info.project.error_desc}}</span>
                                            </div>
                                            <div class="box-body" style=" ">
                                                <table class="table table-bordered">
                                                    <thead>
                                                    <tr>
                                                        <th width="5%">工程</th>
                                                        <th width="5%">分支</th>
                                                        <th width="5%">构建状态</th>
                                                        <th width="5%">代码版本库</th>
                                                        <th width="5%">分支版本号</th>
                                                        <th width="5%">状态</th>
                                                        <th width="5%">提测版本</th>
                                                        <th width="5%">测试中版本</th>
                                                        <th width="5%">申请集成版本</th>
                                                        <th width="5%">当前集成版本</th>
                                                        <th width="5%">操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr ng-repeat="i in info.projectList |filter:filter|paging:page.index:page.size"
                                                        ng-class="{true:'merged_color',false:''}[i.project_status == 'PRO_MERGED']">
                                                        <td>
                                                            {{i.trunk_name}}
                                                            <span ng-if="i.project_status == 'PRO_MERGED'">(原工程分支)</span>
                                                            <span ng-if="i.plan_id != info.project.plan_id">(集成计划分支)</span>
                                                        </td>
                                                        <td>
                                                            <span ng-if="i.isOnBeetle == '0'">
                                                                <a href="javascript:void(0)" class="btn-link"
                                                                   type="button"
                                                                   data-toggle="popover" data-placement="auto top"
                                                                   data-content="{{i.branchTip}}" data-html="true"
                                                                   data-trigger="hover">
                                                                {{i.project_name | limitTo: 20}}...</a>
                                                            <img uib-popover="点击跳转至工程构建页面"
                                                                 ng-show="i.isOnBeetle == '0' && i.package_type!='maven_jar'"
                                                                 popover-trigger="mouseenter"
                                                                 src="/beetle/image/link.png" ng-click="link(i);"
                                                                 style="cursor: pointer;width: 20px;float: right;">
                                                            </span>
                                                        </td>
                                                        <td>
                                                            <span ng-if="i.isOnBeetle == '0'">
                                                                {{i.build_status}}
                                                            </span>
                                                        </td>
                                                        <td>
                                                            <span ng-if="i.isOnBeetle == '0'">
                                                                <span ng-if="i.vcs_path.length <= 20">{{i.vcs_path}}</span>
                                                                <a ng-if="i.vcs_path.length > 20"
                                                                   href="javascript:void(0)"
                                                                   class="btn-link" type="button"
                                                                   popover-placement="auto top"
                                                                   popover-trigger="outsideClick"
                                                                   uib-popover-html="i.vcs_path">{{i.vcs_path | limitTo
                                                                    :20}}...</a>
                                                            </span>
                                                        </td>
                                                        <td>
                                                            {{i.branch_num}}
                                                        </td>
                                                        <td>
                                                            {{getStatusDesc(i.project_status)}}
                                                        </td>
                                                        <td>
                                                            {{i.to_test_edition}}
                                                        </td>
                                                        <td>
                                                            {{i.testing_edition}}
                                                        </td>
                                                        <td>
                                                            {{i.to_integration_edition}}
                                                        </td>
                                                        <td>
                                                            {{i.integrationing_edition}}
                                                        </td>
                                                        <td>
                                                            <i ng-show="(i.isOnBeetle == '0' && i.project_status != 'PRO_MERGED' && i.package_type!='maven_jar') || (i.package_type=='ad')"
                                                               class="glyphicon glyphicon-hand-right"
                                                               ng-click="project_edit(i)" uib-popover="修改工程当前提测版本"
                                                               popover-trigger="mouseenter" popover-placement="left"
                                                               style="cursor: pointer;width: 23px;"></i>
                                                            <i ng-show="isUserCanOperateByRole('plan_admin','pm','dev','qa') && i.project_status != 'PRO_MERGED' && ((i.isOnBeetle == '0'  && i.package_type!='maven_jar') || (i.package_type=='ad'))"
                                                               class="glyphicon glyphicon-hand-right"
                                                               ng-click="updateToIntegrationEdition(i)"
                                                               uib-popover="修改工程申请集成版本" popover-trigger="mouseenter"
                                                               popover-placement="left"
                                                               style="cursor: pointer;width: 23px;color: gold;"></i>
                                                            <!--测试通过 测试不通过 重新推送-->
                                                            <i class="glyphicon glyphicon-thumbs-up"
                                                               ng-if="i.integrationing_edition != null && isUserCanOperateByRole('plan_admin','qa')"
                                                               ng-click="updateTestStatusConfirm(i,true);"
                                                               uib-popover="测试通过,准备发版" popover-trigger="mouseenter"
                                                               popover-placement="left"
                                                               style="cursor: pointer;width: 23px;"></i>
                                                            <i class="glyphicon glyphicon-thumbs-down"
                                                               ng-if="i.integrationing_edition != null && isUserCanOperateByRole('plan_admin','qa')"
                                                               ng-click="updateTestStatusConfirm(i,false);"
                                                               uib-popover="发现Bug" popover-trigger="mouseenter"
                                                               popover-placement="left"
                                                               style="cursor: pointer;width: 23px;"></i>

                                                            <i class="glyphicon glyphicon-trash" ng-click="del(i);"
                                                               style="cursor: pointer;width: 20px;" uib-popover="删除工程"
                                                               popover-trigger="mouseenter"
                                                               popover-placement="left"></i>
                                                            <i ng-show="i.isOnBeetle == '0' && i.package_type!='maven_jar' && i.project_status != 'PRO_MERGED'"
                                                               class="fa fa-code-fork" ng-click="changePlanPro(i);"
                                                               uib-popover="切换分支" popover-trigger="mouseenter"
                                                               popover-placement="left"
                                                               style="cursor: pointer;font-size: 18px;"></i>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <uib-pagination total-items="info.projectList|filter:filter|size"
                                                            ng-model="page.index"
                                                            max-size="5"
                                                            previous-text="上一页"
                                                            next-text="下一页"
                                                            first-text="首页"
                                                            last-text="尾页"
                                                            items-per-page="page.size"
                                                            class="pagination-sm pull-right"
                                                            boundary-links="true"></uib-pagination>
                                        </div>
                                        <div ng-show="info.index==1">
                                            <table width="95%" style="height:260px;">
                                                <tbody>
                                                <tr>
                                                    <td>禅道ID:</td>
                                                    <td>
                                                        <div class="row">
                                                            <div class="col-xs-6" style="width: 60%;">
                                                                <input type="text" placeholder="" style="width: 280px"
                                                                       ng-model="info.project.zt_id"
                                                                       ng-disabled="info.project.zt_id !=''">&nbsp;&nbsp;
                                                                <!-- <img src="/beetle/image/icon_cog.png" ng-click="Refresh();" style="cursor: pointer;width: 20px;"> -->
                                                                <i ng-if="info.modifiAble"
                                                                   class="glyphicon glyphicon-refresh i_class"
                                                                   data-ng-click="Refresh();"
                                                                   uib-popover="同步禅道项目信息"
                                                                   popover-trigger="mouseenter"></i>
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>项目名:</td>
                                                    <td>
                                                        <div class="row">
                                                            <div class="col-xs-6" style="width: 60%;">
                                                                <input type="text" placeholder=""
                                                                       ng-model="info.project.plan_name"
                                                                       ng-disabled="info.project.plan_name!=''">
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>项目代号:</td>
                                                    <td>
                                                        <div class="row">
                                                            <div class="col-xs-6" style="width: 60%;">
                                                                <input type="text" placeholder=""
                                                                       ng-model="info.project.plan_code"
                                                                       ng-disabled="info.project.plan_code">
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>项目日期:</td>
                                                    <td>
                                                        <div class="row">
                                                            <!--<div class="col-xs-6" style="width: 20%"-->
                                                                 <!--ng-if="info.modifiAble">-->

                                                                <!--<input style="width: 100px; float: left; "-->
                                                                       <!--clear-text="清除" close-text="关闭"-->
                                                                       <!--current-text="今天" ng-readonly="true"-->
                                                                       <!--ng-model="info.project.start_date" type="text"-->
                                                                       <!--class="form-control "-->
                                                                       <!--uib-datepicker-popup is-open="start_date"-->
                                                                       <!--ng-required="true"-->
                                                                       <!--close-text="Close" ng-change="updatePlanInfo()"-->
                                                                       <!--ng-click="start_date=!start_date ">-->
                                                                <!--<span style="margin-left: 7px;">至</span>-->
                                                                <!--<input style="width: 100px; float: right;"-->
                                                                       <!--clear-text="清除" close-text="关闭"-->
                                                                       <!--current-text="今天" ng-readonly="true"-->
                                                                       <!--ng-model="info.project.end_date"-->
                                                                       <!--type="text" class="form-control"-->
                                                                       <!--uib-datepicker-popup-->
                                                                       <!--is-open="end_date" ng-required="true"-->
                                                                       <!--close-text="Close"-->
                                                                       <!--ng-change="updatePlanInfo()"-->
                                                                       <!--ng-click="end_date=!end_date">-->

                                                            <!--</div>-->
                                                            <div>
                                                                {{info.project.start_date|date:'yyyy-MM-dd'}}<span
                                                                    style="margin-left: 7px;">至</span>{{info.project.end_date|date:'yyyy-MM-dd'}}
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>集成日期:</td>
                                                    <td>
                                                        <div class="row">
                                                            <div class="col-xs-6" ng-if="info.modifiAble"
                                                                 style="width: 20%;">
                                                                <input clear-text="清除" close-text="关闭" current-text="今天"
                                                                       ng-readonly="true"
                                                                       ng-model="info.project.expect_integration_date"
                                                                       type="text" class="form-control"
                                                                       uib-datepicker-popup
                                                                       is-open="endExceptTimeOpened" ng-required="true"
                                                                       close-text="Close"
                                                                       ng-change="updatePlanInfo()"
                                                                       ng-click="endExceptTimeOpened=!endExceptTimeOpened"/>

                                                            </div>
                                                            <div ng-if="!info.modifiAble">
                                                                {{info.project.expect_integration_date|date:'yyyy-MM-dd'}}
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>上线时间:</td>
                                                    <td>
                                                        <div class="row">
                                                            <div class="col-xs-6" ng-if="info.modifiAble"
                                                                 style="width: 20%;">
                                                                <input clear-text="清除" close-text="关闭" current-text="今天"
                                                                       ng-readonly="true"
                                                                       ng-model="info.project.expect_release_date"
                                                                       type="text" class="form-control"
                                                                       uib-datepicker-popup
                                                                       is-open="release_dateOpened" ng-required="true"
                                                                       close-text="Close"
                                                                       ng-change="updatePlanInfo()"
                                                                       ng-click="release_dateOpened=!release_dateOpened"/>

                                                            </div>
                                                            <div ng-if="!info.modifiAble">

                                                                {{info.project.expect_release_date|date:'yyyy-MM-dd'}}
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div ng-show="info.index==2">
                                            <table width="95%">
                                                <tbody>
                                                <tr style="height: 50px;">
                                                    <td style="width: 100px;">项目负责人:</td>
                                                    <td>
                                                        <div class="row">
                                                            <div class="col-xs-6" style="width: 60%;">

                                                                <input ng-hide="info.PMlock"
                                                                       class="input-medium search-query" type="text"
                                                                       placeholder="" data-items="4"
                                                                       style="width:180px;"
                                                                       ng-model="info.project.PM_name"
                                                                       uib-typeahead="i as i.realname  for i in info.userList | filter:{realname:$viewValue}|limitTo:15"/>


                                                                <span ng-show="info.PMlock">{{info.project.PM_name}}</span>&nbsp;&nbsp;
                                                                <i ng-if="info.modifiAble"
                                                                   class="glyphicon glyphicon-edit i_class"
                                                                   ng-show="info.PMlock"
                                                                   data-ng-click="editPM();" uib-popover=""
                                                                   popover-trigger="mouseenter"></i>
                                                                <i ng-if="info.modifiAble"
                                                                   class="glyphicon glyphicon-floppy-disk i_class"
                                                                   ng-hide="info.PMlock"
                                                                   data-ng-click="editPM();" uib-popover="保存"
                                                                   popover-trigger="mouseenter"></i>

                                                                <i ng-if="info.modifiAble"
                                                                   class="glyphicon glyphicon-ban-circle i_class"
                                                                   ng-hide="info.PMlock"
                                                                   data-ng-click="ClosePM();" uib-popover="放弃修改"
                                                                   popover-trigger="mouseenter"></i>
                                                                <i ng-if="info.modifiAble"
                                                                   class="glyphicon glyphicon-refresh i_class"
                                                                   style="margin-left: 10%;"
                                                                   data-ng-click="initPlanMembers();"
                                                                   uib-popover="同步禅道项目成员"
                                                                   popover-trigger="mouseenter"></i>
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr style="height: 50px;">
                                                    <td>开发人员:</td>
                                                    <td>
                                                        <div class="row">
                                                            <div class="col-xs-6" style="width: 60%;">

                                                                <div class="form-inline" ng-hide="info.userlock">
                                                                    <ui-select multiple ng-model="info.userlists"
                                                                               theme="bootstrap"
                                                                               close-on-select="false"
                                                                               style="width: 300px;"
                                                                               title="Choose a color">
                                                                        <ui-select-match
                                                                                placeholder="Select personnel...">
                                                                            {{$item.realname}}
                                                                        </ui-select-match>
                                                                        <ui-select-choices
                                                                                repeat="i in info.userList | filter:$select.search|limitTo:15">
                                                                            {{i.realname}}
                                                                        </ui-select-choices>
                                                                    </ui-select>
                                                                    <i ng-if="info.modifiAble"
                                                                       class="glyphicon glyphicon-floppy-disk i_class"
                                                                       data-ng-click="addUsers();" uib-popover=""
                                                                       popover-trigger="mouseenter"></i>
                                                                    <i ng-if="info.modifiAble"
                                                                       class="glyphicon glyphicon-ban-circle i_class"
                                                                       ng-hide="info.userlock"
                                                                       data-ng-click="CloseUsers();"
                                                                       uib-popover="放弃修改"
                                                                       popover-trigger="mouseenter"></i>
                                                                </div>

                                                                <span ng-show="info.userlock">{{info.project.member}}</span>
                                                                <i ng-if="info.modifiAble"
                                                                   class="glyphicon glyphicon-edit i_class"
                                                                   ng-show="info.userlock"
                                                                   data-ng-click="addUsers();" uib-popover="保存"
                                                                   popover-trigger="mouseenter"></i>

                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>

                                                </tbody>
                                            </table>
                                        </div>
                                        <div ng-if="info.index == '3'">
                                            <div class="box-body" style="width: 40%; ">
                                                <button class="btn btn-default pull-left" data-ng-click="keepAgent();">保留环境
                                                </button>
                                                <br>
                                                <br>
                                                <span style="color: dodgerblue;">当项目到期后,运维会回收环境。申请保留后，运维会延期7天回收。</span>
                                                <br>
                                                <br>
                                                <table class="table table-bordered">
                                                    <thead>
                                                    <tr>
                                                        <th width="5%">虚拟机</th>
                                                        <th width="10%">IP</th>
                                                        <th width="5%">状态</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr class="item" ng-repeat="i in info.ApplyInfo">
                                                        <td>
                                                            {{i.type}}
                                                        </td>
                                                        <td>
                                                            <a href="javascript:void(0);" class="btn-link" type="button"
                                                               ng-click="toAgent(i);">{{i.agent_ip}}</a>
                                                        </td>
                                                        <td>
                                                            {{i.status}}
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                        <div ng-if="info.index == '4'">
                                            <u-test-record is-project='false' project-id='{{id}}'></u-test-record>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>